﻿#pragma once
#include<string>
#
class Goods

{
public:
	double price;
	std::string goodsname;
	std::string catalog;
	//std::string press;//出版社
	int goodsid;
	int contain;//库存容量

	void display();
	int   getgoodsid();
	std::string   getgoodsname();
	std::string   getcatlog();
	int getcontain();
	double getprice();
	//std::string   getpress();
	Goods(double price1, std::string   name1, std::string   catalog1, int goodsid1, int contain1);
	Goods();
	std::string formatInfo();
	 virtual void ShowMe() ;  // 纯虚函数ShowMe()
	friend std::istream& operator>>(std::istream& is, Goods& obj);//重载运算符>>；
};
class DailyGoods : public Goods //日常用品子类
{
public:
	void ShowMe() override;
};

class Food : public Goods //食品子类
{
public:
	int Shelf_life;//保质期

	int getShelf_life();
	Food(double price1, std::string name1, std::string catalog1, int goodsid1, int contain1, int Shelf_life1)
		: Goods(price1, name1, catalog1, goodsid1, contain1), Shelf_life(Shelf_life1) //有参构造
	{};
	void ShowMe() override;
};

class ElectricalAppliance : public Goods //家电子类
{
public:
	std::string color;//颜色

	std::string getcolor();
	ElectricalAppliance(double price1, std::string name1, std::string catalog1, int goodsid1, int contain1, std::string color1)
		: Goods(price1, name1, catalog1, goodsid1, contain1), color(color1) //有参构造
	{};
	void ShowMe() override;
};

